package com.zzyl.generator.util;

import com.zzyl.generator.util.VelocityInitializer;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;

import java.io.FileWriter;
import java.io.IOException;

public class Test {
    public static void main(String[] args) throws IOException {
        // 1. 初始化模板引擎
        VelocityInitializer.initVelocity();
        // 2. 获取模板
        Template template = Velocity.getTemplate("vms/index.html.vm");
        // 3. 准备填充内容
        VelocityContext context = new VelocityContext();
        context.put("message", "老爷");
        // 4. 合并
        FileWriter fw = new FileWriter("D:/index.html");
        template.merge(context, fw);
        fw.close();
    }
}